package io;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class InputStreamReaderDemo {

	public static void main(String[] args) throws Exception {

		try(BufferedWriter bufferedWriter =   new BufferedWriter(new FileWriter(new File("f1.txt")))) {
			bufferedWriter.append("哈哈");
			bufferedWriter.newLine();
			bufferedWriter.write("xxxxyyy");
			bufferedWriter.flush();
		} catch (Exception e) {
			// TODO: handle exception
		}
		
		
		FileReader fReader = new FileReader(new File("f1.txt"));
		BufferedReader bufferedReader = new BufferedReader(fReader);
		BufferedReader bufferedReader1 = new BufferedReader(new InputStreamReader(new FileInputStream("f1.txt")));//字节流中转字符流的方式 
		String str= "";
		while ((str = bufferedReader.readLine()) != null) {
			System.out.println(str);
		}
		fReader.close();

		
		
	}

}
